package ai.yue.open.service.cd.ipo;

import ai.yue.library.base.ipo.ValidationGroups;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 配置-bearer_token
 *
 * @author yl-yue
 * @since  2023/2/7
 */
@Data
public class ConfRancherIPO {

    private static final long serialVersionUID = 1L;

    @NotNull(groups = {ValidationGroups.Update.class})
    private Long id;

    /**
     * Rancher API地址：重新部署时使用
     */
    @NotBlank
    private String rancherApiUrl;

    /**
     * bearerToken值：调用 Rancher API所使用的bearerToken
     */
    @NotBlank
    private String bearerToken;

    /**
     * 匹配的命名空间：在Rancher中创建命名空间时，建议全局唯一，这样好用命名空间区分多个环境
     * - test1、test2、test3
     * - test、uat、prod
     */
    @NotNull
    @JSONField(deserializeUsing = JSONArray.class)
    private List<String> namespaceList;

}
